package com.jwt.utils;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.security.core.Authentication;

import java.util.Date;

public class JwtUtils {
	public static String generateToken(Authentication authentication){
		String token= Jwts.builder()
				.claim("authentication",authentication)
				.setSubject(authentication.getName())
				.setExpiration(new Date(System.currentTimeMillis()+3600000))
				.signWith(SignatureAlgorithm.HS256,"jwtccsss")
				.compact();
		return token;
	}
}
